import {
	WeaLocaleProvider
} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
var localeKey = 'e9_locale';
var langId= 7;

try{
    langId=(window.localStorage&& window.localStorage.login) ? (JSON.parse(window.localStorage.login).langId?JSON.parse(window.localStorage.login).langId:7) :7;
}catch(e){}
var language = langId||(window[localeKey]&&window[localeKey].userLanguage)||7;
if(localStorage && localStorage.languageidweaver) {
    langId = localStorage.languageidweaver;
}
window.workplanCalendarI18n = $.extend({}, window.workplanCalendarI18n||{}, {
    xgcalendar: {
        dateformat: {
            "fulldaykey": 'yyyyMMdd',
            "fulldayshow": (langId==7||langId==9)? 'yyyy年M月d日' : 'L d yyyy',
            "fulldayvalue": (langId==7||langId==9)? 'yyyy-MM-dd':'yyyy-MM-dd',
            "Md": (langId==7||langId==9)? 'M月d日 (W)' : 'W M/d',
            "Md3": (langId==7||langId==9)? 'M月d日' : 'L d',
            "yM": (langId==7||langId==9)? 'yyyy年M月' : 'L yyyy',
            "separator": '-',
            "year_index": 0,
            "month_index": 1,
            "day_index": 2,
            "day": getLabel(519827, 'd日'),
            "sun": getLabel(519828, '周日'),
            "mon": getLabel(519829, '周一'),
            "tue": getLabel(519830, '周二'),
            "wed": getLabel(519831, '周三'),
            "thu": getLabel(519832, '周四'),
            "fri": getLabel(519833, '周五'),
            "sat": getLabel(519834, '周六'),
            "jan": getLabel(519835, '一月'),
            "feb": getLabel(519836, '二月'),
            "mar": getLabel(519837, '三月'),
            "apr": getLabel(519838, '四月'),
            "may": getLabel(519839, '五月'),
            "jun": getLabel(519840, '六月'),
            "jul": getLabel(519841, '七月'),
            "aug": getLabel(519842, '八月'),
            "sep": getLabel(519843, '九月'),
            "oct": getLabel(519844, '十月'),
            "nov": getLabel(519845, '十一月'),
            "dec": getLabel(519846, '十二月')
        },
        "no_implemented": getLabel(519847, '没有实现'),
        "to_date_view": getLabel(519848, '点击转到该日期的日视图'),
        "i_undefined": getLabel(519849, '未设置'),
        "allday_event": getLabel(519850, '全天日程'),
        "repeat_event": getLabel(519851, '跨天日程'),
        "time": getLabel(519852, '时间'),
        "event": getLabel(519853, '事件'),
        "location": getLabel(519854, '地点'),
        "participant": getLabel(519855, '参与人'),
        "get_data_exception": getLabel(519856, '获取数据发生异常'),
        "new_event": getLabel(519857, '新日程'),
        "confirm_delete_event": getLabel(519858, '确定删除该日程吗？'),
        "confrim_delete_event_or_all": getLabel(519859, '删除此序列还是单个事件？\r\n点击[确定]删除事件,点击[取消]删除序列'),
        "data_format_error": getLabel(519860, '数据格式错误！'),
        "invalid_title": getLabel(519861, '日程标题不能为空'),
        "view_no_ready": getLabel(519862, '视图未准备完毕'),
        "example": getLabel(519863, '例如：有个办公会议'),
        "content": getLabel(519864, '內 容'),
        "create_event": getLabel(519865, '保存'),
        "update_detail": getLabel(519866, '修改日程详细信息'),
        "click_to_detail": getLabel(519867, '点击查看详细'),
        "i_delete": getLabel(519868, '刪除'),
        "day_plural": getLabel(519869, '天'),
        "others": getLabel(519870, '另外'),
        "item": getLabel(519871, '个'),
        "edit_event": getLabel(519872, '编辑日程'),
        "viewDetail": getLabel(519873, '查看详细'),
        "allday": getLabel(519874, '全天'),
        "new_current_event": getLabel(519875, '新建当天日程'),
        "new_cross_event": getLabel(519876, '新建跨天日程')
    },
    datepicker: {
        dateformat: {
            "fulldayvalue":  (langId==7||langId==9)? 'yyyy-M-d' : 'M/d/yyyy',
            "separator": (langId==7||langId==9)? '-':'/',
            "year_index": (langId==7||langId==9)? 0 : 2,
            "month_index": (langId==7||langId==9)? 1 : 0,
            "day_index": (langId==7||langId==9)? 2 : 1,
            "sun": getLabel(519879, '日'),
            "mon": getLabel(519880, '一'),
            "tue": getLabel(519881, '二'),
            "wed": getLabel(519882, '三'),
            "thu": getLabel(519883, '四'),
            "fri": getLabel(519884, '五'),
            "sat": getLabel(519885, '六'),
            "jan": getLabel(519886, '一'),
            "feb": getLabel(519887, '二'),
            "mar": getLabel(519888, '三'),
            "apr": getLabel(519889, '四'),
            "may": getLabel(519890, '五'),
            "jun": getLabel(519891, '六'),
            "jul": getLabel(519892, '七'),
            "aug": getLabel(519893, '八'),
            "sep": getLabel(519894, '九'),
            "oct": getLabel(519895, '十'),
            "nov": getLabel(519896, '十一'),
            "dec": getLabel(519897, '十二'),
            "postfix": getLabel(519899, '月')
        },
        ok: getLabel(519900, ' 确定 '),
        cancel: getLabel(519901, ' 取消 '),
        today: getLabel(519902, '今天'),
        prev_month_title: getLabel(519903, '上一月'),
        next_month_title: getLabel(519904, '下一月')
    },
    moment:{
        dateformat: {
            "fulldayshow": (langId==7||langId==9)? 'YYYY年MM月DD日' : 'MMM DD YYYY',
            "fulldayvalue": (langId==7||langId==9)? 'YYYY-MM-DD': 'YYYY-MM-DD',
            "Md": (langId==7||langId==9)? 'MM月DD日': 'MMM DD',
            "Md3": (langId==7||langId==9)? 'MM月DD日 (ddd)': 'MMM DD (ddd)',
            "Md4": (langId==7||langId==9)? 'MM月DD日 (d)': 'MMM DD (dddd)',
            "yM": (langId==7||langId==9)? 'YYYY年MM月' : 'MMM YYYY',
            "yMd": (langId==7||langId==9)? 'YYYY年MM月DD日' : 'MMM DD YYYY',
        },
    },
    ant_datepicker:{
        "lang": {
          "placeholder": getLabel(519912, '请选择日期'),
          "today": getLabel(519902, '今天'),
          "now": getLabel(519913, '此刻'),
          "backToToday": getLabel(519914, '返回今天'),
          "ok": getLabel(519900, '确定'),
          "clear": getLabel(519915, '清除'),
          "month": getLabel(519916, '月'),
          "year": getLabel(519917, '年'),
          "timeSelect": getLabel(519918, '选择时间'),
          "dateSelect": getLabel(519919, '选择日期'),
          "monthSelect": getLabel(519920, '选择月份'),
          "yearSelect": getLabel(519921, '选择年份'),
          "decadeSelect": getLabel(519936, '选择年代'),
          "yearFormat": (langId==7||langId==9)? 'YYYY年':'YYYY',
          "dateFormat": (langId==7||langId==9)? 'YYYY年M月D日': 'M/D/YYYY',
          "dayFormat": (langId==7||langId==9)? 'D日' : 'D',
          "dateTimeFormat": (langId==7)? 'YYYY年M月D日 HH时mm分ss秒':langId==9? 'YYYY年M月D日 HH時mm分ss秒' : 'M/D/YYYY HH:mm:ss',
          "monthFormat": (langId==7||langId==9)? 'MMMM': 'MMMM',
          "monthBeforeYear": true,
          "previousMonth": getLabel(519927, '上个月 (翻页上键)'),
          "nextMonth": getLabel(519928, '下个月 (翻页下键)'),
          "previousYear": getLabel(519929, '上一年 (Control键加左方向键)'),
          "nextYear": getLabel(519930, '下一年 (Control键加右方向键)'),
          "previousDecade": getLabel(519931, '上一年代'),
          "nextDecade": getLabel(519932, '下一年代'),
          "previousCentury": getLabel(519933, '上一世纪'),
          "nextCentury": getLabel(519934, '下一世纪'),
        },
        "timePickerLocale": {
          "placeholder": getLabel(519935, '请选择时间')
        }
      },
      langId:langId
}); 

export const setWorkplanCalendarI18n = function(callback) {
    if(localStorage && localStorage.languageidweaver) {
        langId = localStorage.languageidweaver;
    }
    window.workplanCalendarI18n = $.extend({}, window.workplanCalendarI18n||{}, {
        xgcalendar: {
            dateformat: {
                "fulldaykey": 'yyyyMMdd',
                "fulldayshow": (langId==7||langId==9)? 'yyyy年M月d日' : 'L d yyyy',
                "fulldayvalue": (langId==7||langId==9)? 'yyyy-MM-dd':'yyyy-MM-dd',
                "Md": (langId==7||langId==9)? 'M月d日 (W)' : 'W M/d',
                "Md3": (langId==7||langId==9)? 'M月d日' : 'L d',
                "yM": (langId==7||langId==9)? 'yyyy年M月' : 'L yyyy',
                "separator": '-',
                "year_index": 0,
                "month_index": 1,
                "day_index": 2,
                "day": getLabel(519827, 'd日'),
                "sun": getLabel(519828, '周日'),
                "mon": getLabel(519829, '周一'),
                "tue": getLabel(519830, '周二'),
                "wed": getLabel(519831, '周三'),
                "thu": getLabel(519832, '周四'),
                "fri": getLabel(519833, '周五'),
                "sat": getLabel(519834, '周六'),
                "jan": getLabel(519835, '一月'),
                "feb": getLabel(519836, '二月'),
                "mar": getLabel(519837, '三月'),
                "apr": getLabel(519838, '四月'),
                "may": getLabel(519839, '五月'),
                "jun": getLabel(519840, '六月'),
                "jul": getLabel(519841, '七月'),
                "aug": getLabel(519842, '八月'),
                "sep": getLabel(519843, '九月'),
                "oct": getLabel(519844, '十月'),
                "nov": getLabel(519845, '十一月'),
                "dec": getLabel(519846, '十二月')
            },
            "no_implemented": getLabel(519847, '没有实现'),
            "to_date_view": getLabel(519848, '点击转到该日期的日视图'),
            "i_undefined": getLabel(519849, '未设置'),
            "allday_event": getLabel(519850, '全天日程'),
            "repeat_event": getLabel(519851, '跨天日程'),
            "time": getLabel(519852, '时间'),
            "event": getLabel(519853, '事件'),
            "location": getLabel(519854, '地点'),
            "participant": getLabel(519855, '参与人'),
            "get_data_exception": getLabel(519856, '获取数据发生异常'),
            "new_event": getLabel(519857, '新日程'),
            "confirm_delete_event": getLabel(519858, '确定删除该日程吗？'),
            "confrim_delete_event_or_all": getLabel(519859, '删除此序列还是单个事件？\r\n点击[确定]删除事件,点击[取消]删除序列'),
            "data_format_error": getLabel(519860, '数据格式错误！'),
            "invalid_title": getLabel(519861, '日程标题不能为空'),
            "view_no_ready": getLabel(519862, '视图未准备完毕'),
            "example": getLabel(519863, '例如：有个办公会议'),
            "content": getLabel(519864, '內 容'),
            "create_event": getLabel(519865, '保存'),
            "update_detail": getLabel(519866, '修改日程详细信息'),
            "click_to_detail": getLabel(519867, '点击查看详细'),
            "i_delete": getLabel(519868, '刪除'),
            "day_plural": getLabel(519869, '天'),
            "others": getLabel(519870, '另外'),
            "item": getLabel(519871, '个'),
            "edit_event": getLabel(519872, '编辑日程'),
            "viewDetail": getLabel(519873, '查看详细'),
            "allday": getLabel(519874, '全天'),
            "new_current_event": getLabel(519875, '新建当天日程'),
            "new_cross_event": getLabel(519876, '新建跨天日程')
        },
        datepicker: {
            dateformat: {
                "fulldayvalue":  (langId==7||langId==9)? 'yyyy-M-d' : 'M/d/yyyy',
                "separator": (langId==7||langId==9)? '-':'/',
                "year_index": (langId==7||langId==9)? 0 : 2,
                "month_index": (langId==7||langId==9)? 1 : 0,
                "day_index": (langId==7||langId==9)? 2 : 1,
                "sun": getLabel(519879, '日'),
                "mon": getLabel(519880, '一'),
                "tue": getLabel(519881, '二'),
                "wed": getLabel(519882, '三'),
                "thu": getLabel(519883, '四'),
                "fri": getLabel(519884, '五'),
                "sat": getLabel(519885, '六'),
                "jan": getLabel(519886, '一'),
                "feb": getLabel(519887, '二'),
                "mar": getLabel(519888, '三'),
                "apr": getLabel(519889, '四'),
                "may": getLabel(519890, '五'),
                "jun": getLabel(519891, '六'),
                "jul": getLabel(519892, '七'),
                "aug": getLabel(519893, '八'),
                "sep": getLabel(519894, '九'),
                "oct": getLabel(519895, '十'),
                "nov": getLabel(519896, '十一'),
                "dec": getLabel(519897, '十二'),
                "postfix": getLabel(519899, '月')
            },
            ok: getLabel(519900, ' 确定 '),
            cancel: getLabel(519901, ' 取消 '),
            today: getLabel(519902, '今天'),
            prev_month_title: getLabel(519903, '上一月'),
            next_month_title: getLabel(519904, '下一月')
        },
        moment:{
            dateformat: {
                "fulldayshow": (langId==7||langId==9)? 'YYYY年MM月DD日' : 'MMM DD YYYY',
                "fulldayvalue": (langId==7||langId==9)? 'YYYY-MM-DD': 'YYYY-MM-DD',
                "Md": (langId==7||langId==9)? 'MM月DD日': 'MMM DD',
                "Md3": (langId==7||langId==9)? 'MM月DD日 (ddd)': 'MMM DD (ddd)',
                "Md4": (langId==7||langId==9)? 'MM月DD日 (d)': 'MMM DD (dddd)',
                "yM": (langId==7||langId==9)? 'YYYY年MM月' : 'MMM YYYY',
                "yMd": (langId==7||langId==9)? 'YYYY年MM月DD日' : 'MMM DD YYYY',
            },
        },
        ant_datepicker:{
            "lang": {
              "placeholder": getLabel(519912, '请选择日期'),
              "today": getLabel(519902, '今天'),
              "now": getLabel(519913, '此刻'),
              "backToToday": getLabel(519914, '返回今天'),
              "ok": getLabel(519900, '确定'),
              "clear": getLabel(519915, '清除'),
              "month": getLabel(519916, '月'),
              "year": getLabel(519917, '年'),
              "timeSelect": getLabel(519918, '选择时间'),
              "dateSelect": getLabel(519919, '选择日期'),
              "monthSelect": getLabel(519920, '选择月份'),
              "yearSelect": getLabel(519921, '选择年份'),
              "decadeSelect": getLabel(519936, '选择年代'),
              "yearFormat": (langId==7||langId==9)? 'YYYY年':'YYYY',
              "dateFormat": (langId==7||langId==9)? 'YYYY年M月D日': 'M/D/YYYY',
              "dayFormat": (langId==7||langId==9)? 'D日' : 'D',
              "dateTimeFormat": (langId==7)? 'YYYY年M月D日 HH时mm分ss秒':langId==9? 'YYYY年M月D日 HH時mm分ss秒' : 'M/D/YYYY HH:mm:ss',
              "monthFormat": (langId==7||langId==9)? 'MMMM': 'MMMM',
              "monthBeforeYear": true,
              "previousMonth": getLabel(519927, '上个月 (翻页上键)'),
              "nextMonth": getLabel(519928, '下个月 (翻页下键)'),
              "previousYear": getLabel(519929, '上一年 (Control键加左方向键)'),
              "nextYear": getLabel(519930, '下一年 (Control键加右方向键)'),
              "previousDecade": getLabel(519931, '上一年代'),
              "nextDecade": getLabel(519932, '下一年代'),
              "previousCentury": getLabel(519933, '上一世纪'),
              "nextCentury": getLabel(519934, '下一世纪'),
            },
            "timePickerLocale": {
              "placeholder": getLabel(519935, '请选择时间')
            }
          },
          langId:langId
    }); 

    typeof callback === 'function' && callback();
}